/**
 * Copyright (C) Inexas 2009, All rights reserved.
 *
 * @author keith
 */
package com.inexas.cu.client.mvp;

import com.google.gwt.validation.client.*;

public class ValidationError {
	private final String message;
	private final String value;

	public ValidationError(InvalidConstraint<? extends PresentationManager> constraint) {
		message = constraint.getMessage();
		value = constraint.getValue().toString();
	}

	public String getMessage() {
		return message;
	}

	public String getValue() {
		return value;
	}

	@Override
	public int hashCode() {
		return message.hashCode();
	}

	@Override
	public boolean equals(Object rhsObject) {
		final ValidationError rhs = (ValidationError)rhsObject;
		return message.equals(rhs.message);
	}

	@Override
	public String toString() {
		return "ValidationError(" + message + ')';
	}

}